package com.zygh.dlqwservice.module.controller.pc;

import com.zygh.dlqwservice.common.anno.NoNeedLogin;
import com.zygh.dlqwservice.common.anno.OperateLog;
import com.zygh.dlqwservice.common.anno.PcLog;
import com.zygh.dlqwservice.common.pcdomain.ResponseDTO;
import com.zygh.dlqwservice.config.token.RequestTokenBO;
import com.zygh.dlqwservice.constant.SwaggerTagConst;
import com.zygh.dlqwservice.module.entity.vo.LoginDetailVO;
import com.zygh.dlqwservice.module.entity.vo.SysUserLoginFormVO;
import com.zygh.dlqwservice.module.service.LoginService;
import com.zygh.dlqwservice.module.service.impl.LoginTokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * 后台登录
 *
 * @author lidoudou
 * @date 2017年12月19日上午11:46:04
 */
@RestController
@RequestMapping("/sys-user")
@Api(tags = {SwaggerTagConst.Admin.MANAGER_USER_LOGIN})
@OperateLog
public class LoginController {
    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    @ApiOperation(value = "登录", notes = "登录")
    @NoNeedLogin
    @PcLog(logType = "0",module = SwaggerTagConst.Admin.MANAGER_USER_LOGIN,content = "登录")
    public ResponseDTO<LoginDetailVO> login(@Valid @RequestBody SysUserLoginFormVO login, HttpServletRequest request) {
        return loginService.login(login, request);
    }

}
